Methods and systems to track a moving objects trajectory using a single camera

ABSTRACT

Systems and methods are described for generating a three-dimensional track a ball in a gaming environment from a single camera. In some examples, an input video including frames of a ball moving in a gaming environment recorded by a camera may be obtained, along with a camera projection matrix associated with at least one frame that maps a two-dimensional pixel space representation to a three-dimensional representation of the gaming environment. Candidate two-dimensional image locations of the ball across the plurality of frames may be identified using a neural network or a computer vision algorithm. An optimization algorithm may be performed that uses a 3D ball physics model, the camera projection matrix and a subset of the candidate two-dimensional image locations of the ball to generate a three-dimensional track of the ball in the gaming environment. The three-dimensional track of the ball may then be provided to a user device.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.17/730,865, filed on Apr. 27, 2022, entitled “METHODS AND SYSTEMS TOTRACK A MOVING SPORTS OBJECT TRAJECTORY IN 3D USING A SINGLE CAMERA,”which claims the benefit of U.S. Provisional Patent Application No.63/180,228, filed Apr. 27, 2021, entitled “METHODS AND SYSTEMS TO TRACKA MOVING SPORTS OBJECT TRAJECTORY IN 3D USING A SINGLE STATIONARYCAMERA” the disclosures of which are incorporated herein by reference intheir entirety.

BACKGROUND

Over the last two decades, 3D ball tracking has rapidly grown inpopularity at the highest levels of professional sport. Some examples ofthis include the use of Hawkeye Innovations technology or VirtualEyetechnology for reviews at international-level cricket tournaments and attennis grand slams. Today, 3D ball tracking is widely used across sportsfor decision reviews, viewer engagement, and automatic data collection.While average people who play sport, and even professionals who are notplaying in the biggest tournaments, do not expect to play in anenvironment where such technology is enabled, the ability to track theball in 3D and receive the analytics derived from it has become deeplyassociated with the viewing and analysis of the highest levels ofprofessional sport. Data collected from the operation of thesetechnologies is also used by players, teams, coaches and analysts forperformance improvement, as well as by commentators and broadcasters todisplay interesting insights, thereby further engaging audiences. Thereason for the inaccessibility of such technologies at larger scalerelates to their exorbitantly high prices, as well as complicatedmaintenance, installation and operational requirements. Often, thesetechnologies require multiple (e.g., 6-10) high speed cameras operatingat high frames per second (e.g., 340 fps), optic fiber cables connectingthese cameras to a central hub and a number of operators ensuringaccuracy and smooth operation. The plurality of cameras allow fortriangulation of the ball position at a specific moment, and the opticfiber cables allow for the cameras to be time synced with very smallmargin, which makes triangulation more accurate. Such extensive hardwareand manual involvement are crucial to keep the tracking within themargin for error that is permitted at the highest level of sport (forinstance, the International Tennis Federation requires less than 5 mmaccuracy and Hawkeye claims to deliver average accuracy within 2.6 mm).The broad market has much to gain from similar technology, even at loweraccuracy, by using the derived data for performance improvement,scouting, social media sharing, etc. However, the financialinstallation, maintenance and operational obstacles of such technologiesmake them inaccessible. Easier-to-operate, lower-cost solutions, withlower accuracy, have been created for the broader market (e.g.,https://playsight.com/), but these also generally require multiplecameras, additional hardware and a level of investment, maintenance andoperation that is often infeasible for club-level players, academies andeven professionals at practice. Other solutions track the ball in 3Dusing the size of the ball to infer the distance from the object to thecamera, but such solutions fail for small balls/objects as well as incases with high amounts of motion and motion blur in the recording.

In view of the foregoing, a need exists for a 3D ball trackingtechnology that involves minimal hardware, is highly affordable, and iseasy to install and maintain to overcome the aforementioned obstaclespresented by current solutions.

BRIEF DESCRIPTION OF THE DRAWINGS

Various techniques will be described with reference to the drawings, inwhich:

FIG. 1 illustrates an example of a device/system, in a gamingenvironment, to capture video and generate a 3D track and/or othermetrics of a ball in the gaming environment, according to at least oneembodiment;

FIG. 2 illustrates an example 3D ball track or path generated by thedevice/system of FIG. 1 , according to at least one embodiment;

FIG. 3 illustrates an example 3D ball tracking system, according to atleast one embodiment;

FIGS. 4-6 illustrate example steps in a process to determine aprojection matrix for a view in a gaming environment, which may beperformed by the device/system of FIGS. 1 and 3 , according to at leastone embodiment;

FIG. 7 illustrates an example view of captured ball positions in agaming environment, which may be generated by the device/system of FIGS.1 and 3 , according to at least one embodiment;

FIG. 8 illustrates an example view of a generated ball track or pathbased on the captured ball positions illustrated in FIG. 7 , which maybe generated by the device of FIG. 1 , according to at least oneembodiment;

FIG. 9 illustrates an example view of a generated ball track or pathincluding metrics of a pitch, which may be generated by thedevice/system of FIGS. 1 and 3 , according to at least one embodiment;

FIG. 10 illustrates an example process for generating a 3D ball track orpath using a single camera, according to at least one embodiment; and

FIG. 11 illustrates an example process for generating a 3D ball track orpath and associated metrics using a single camera, according to at leastone embodiment.

DETAILED DESCRIPTION

Systems and methods are described herein for generating a track or pathof a ball moving in three dimensions (3D) using a single camera, such asmay be used in various gaming environments. In some aspects, 3D balltracking systems and methods address one or more of the aforementionedproblems by computing the 3D track of a ball moving in a gamingenvironment (e.g., at a cricket game, baseball game, football game,soccer game, basketball game and the like), where video of the gamingenvironment is received from a single stable camera (e.g., a smartphone, digital camera, or the like). In some cases, using varioustechniques, a 3D track may be fitted to a set of 2D points from a videoframe and refined to conform to known physics about the characteristicsof the ball in specific gaming environments.

In some examples, input video of the gaming environment may be recordedby a camera of a user device, such as one or more cameras of asmartphone. As used herein, a single camera may refer to one or morecameras that are co-located, such as one, two, or three, etc., camerasthat are all part of the same camera or device but are collocated. Thecamera may be stable, such as on a tripod or mount, or may be moving,such as a handheld camera or attached to a moving camera operator (e.g.,a camera mounted on a helmet of a player in a gaming environment). Theinput video may include a plurality of frames of a ball moving in agaming environment, such as captured at a minimum of 30 frames persecond (FPS), but which may also be captured at higher rate, such as 60FPS, 90 FPS, 240 FPS, etc., with higher frame rates yielding moreaccurate results. In some cases, the described 3D ball track generationtechniques may be utilized in connection with automatically recordedaction segments in a gaming environment, as described in U.S.application Ser. No. 17/731,005 (attorney docket number 0117250-002US0),titled “METHODS AND SYSTEMS TO AUTOMATICALLY RECORD RELEVANT ACTION IN AGAMING ENVIRONMENT,” the contents of which are hereby incorporated byreference in their entirety.

A camera projection matrix, or matrices, mapping between 2D imagecoordinates and 3D real world coordinates may either be derived orobtained. In some cases, the camera projection matrix may be derived orgenerated by identifying a number of points (e.g., 2, 4, 6, 8, etc.,) inthe gaming environment that have a fixed dimensional relationship witheach other or a known position relative to other objects in the gamingenvironment (e.g., a player). These points may be correlated between atwo-dimensional pixel space representation and a three-dimensionalphysical representation. In the example of cricket, the points mayinclude identifying locations of the batter and bowler stumps (e.g., thetops and bottoms of each of the stumps), as these are at a knowndistance from one another. Using these real-world distances, acorrelation or mapping between 2D pixel space of a given frame of thevideo can be mapped to real world coordinates in 3D. In some embodimentswhere the camera is stable, the camera projection may be the same forthe entire video, e.g., such that a single camera projection matrix maybe determined and used for multiple frames comprising a video. In otherembodiments, a different camera projection matrix may be derived foreach frame or a subset of frames, using several different methodsdescribed in later sections. Multiple camera projection matrices may beused in cases where the camera is moving or not perfectly stationary,such as in a handheld smartphone or other camera device, a cameramounted on another object (e.g., a helmet camera, a camera mounted onanother piece of sports equipment or object tin a gaming environment,and so on). In some cases, when a camera is mostly stationary, but maymove slightly during video recording, one camera a projection matrix maybe used to conserve computing resources at the expense of accuracy. Inother examples, multiple matrices, such as for each frame, or everyother frame, every third frame, etc., may be utilized to optimize adesired balance between accuracy and resources used by the cameradevice/computing device (battery, storage, processing power, etc.).

Candidate two-dimensional image locations of the ball may be identifiedacross the plurality of frames of the input video of the gamingenvironment using, in some examples, a neural network trained on pastvideo inputs of the gaming environment, a camera vision algorithm, or acombination thereof. In some aspects for the cricket example, a deepneural network may be trained with thousands of example images of movingcricket balls. In some examples, this model may be run on every frame ofthe video for a three second period after the bowler releases the ball.The ball is detected in 2D, meaning that the position in the image inpixels is inferred, not the position in meters in the 3D world.

An optimization algorithm may be performed that uses a 3D ball physicsmodel, the camera projection matrix, or matrices, and a subset of thecandidate two-dimensional image locations of the ball to compute theparameters of an equation that estimates the three-dimensional positionof the ball moving in the gaming environment by aligning the subset ofthe candidate two-dimensional image locations of the ball with thethree-dimensional ball physics model. In some cases, the subset ofcandidate locations may be selected or refined using an inlier detectionalgorithm, such as RANSAC in conjunction with the optimizationalgorithm. In yet some cases, selecting the subset of the candidatetwo-dimensional image locations of the ball from the candidatetwo-dimensional image locations of the ball may include removingerroneous candidate locations of the ball. A three-dimensional track ofthe ball may be generated using the determined parameters in theequation that estimates the three-dimensional position of the ballmoving in the gaming environment. In some aspects, the three-dimensionaltrack of the ball and metrics of movement of the ball on thethree-dimensional track may be provided to the user device, such as viaa graphical representation of the track of the ball in the gamingenvironment with metrics overlaid onto or displayed proximate to thegraphical representation of the track.

In some examples, the three-dimensional physics model includes at leastthree equations selected based on movement patterns of the ball in thegaming environment, where the three-dimensional physics model isselected based on a specific type of gaming environment. In the exampleof cricket, the at least three equations may include at least one linearfunction and at least one or two quadratic functions. In some cases, thethree-dimensional 3D ball physics model may take into account bounce,spin, swing, and/or air resistance of the ball throughout a pitch, forexample.

In some cases, generating the 3D ball track may also include applyingone or more constraints to the equation, such as based on thethree-dimensional physics model of the ball, where the constraints areselected based on a specific type of gaming environment. The constraintsmay include one or more of the following: a location in a frame of theplurality of frames of where the ball is pitched from; a sound capturedby the video input that correlates to a specific action or event in thegaming environment; deviation in the horizontal or vertical direction ofthe ball being less than a threshold for a specific gaming environment;a speed of the ball being between a minimum speed and a maximum speed;or a position of one or more of the players in the gaming environment.These constraints may apply know or observed limitations or boundariesto characteristics of the ball and relationships between the ball andobjects in the gaming environment to better refine the generated 3D balltrack.

In the preceding and following description, various techniques aredescribed. For purposes of explanation, specific configurations anddetails are set forth in order to provide a thorough understanding ofpossible ways of implementing the techniques. However, it will also beapparent that the techniques described below may be practiced indifferent configurations without the specific details. Furthermore,well-known features may be omitted or simplified to avoid obscuring thetechniques being described.

As one skilled in the art will appreciate in light of this disclosure,certain embodiments may be capable of achieving certain advantages,including some or all of the following: (1) a more robust system fortracking an object in 3D that only requires one camera; (2) faster andmore efficient calculation of a 3D track of an object requiring lessprocessing resourcing; (3) real time or near real time generation of a3D track of an object for real time analytics and performanceimprovement; and (3) other advantages as will be made apparent in therest of this disclosure. As will be appreciated by the remainder of thisdisclosure, the described systems and techniques provide for a widelyadaptable and intuitive system for use in various gaming environments.

FIG. 1 illustrates an example diagram 100 of a device/system 102, in agaming environment, that can be used to capture video and generate a 3Dtrack and/or other metrics of a ball in the gaming environment. Examplediagram 100 depicts part of a cricket field 116, including bowler andbatter stumps 106, 108, a player in the bowling positing 110, a batter112 and an outline 114 of ball trajectory as it is being pitched by thebowler 110. The 3D ball trajectory 114 is shown as a black line.

As described in greater detail herein, a camera device 102 may bepositioned proximate to and behind the bowler 110 to capture video ofpitches made by the bowler. The video may be analyzed to generate athree-dimensional (3D) track of the ball as it is pitched from the 2Dframes captured by the camera device 102. This generated 3D track may beprovided to the bowler 110, coaches, trainers, and even audiences toprovide for better training of the bowler 110, analysis of game play,and even top enhance the audience's experience while watching a game.

In some aspects, a stable camera, or a camera stable for at least a fewseconds, may be advantageous in providing more accurate cameraalignment/generating a camera projection matrix, to better map the 2Dimage data to 3D physical coordinates. As illustrated, in some examples,this may be accomplished by a tripod or other camera or smartphonestabilization device. The camera device 102 may be positioned anywhereproximate to the movement of the ball that is desired to be captured,and preferably with an unobstructed view of the ball through the rangeof movement desired to be captured. One advantage of the describedsystems and techniques is that perfect camera alignment or a specificposition is not needed, as the camera can be calibrated at any location,whether it is stable or unstable.

An example coordinate system is also shown in the image via directioncon 118. The arrows point in the positive direction for each axis. Allreal-world units are described herein in meters, however othermeasurement systems (e.g., standard), can be used to similar effect. Inone example, the origin may be the center of the pitch on the ground.This point for the origin may be selected to provide symmetry for thegaming environment. The X axis may be aligned sideways or perpendicularto the direction of the throw of the ball (leg side vs offside). The Yaxis may represent the vertical direction, where positive is above theground. The Z axis may represent the direction of the throw of the ball,where positive is towards the direction of the bowler or batter. Itshould be appreciated that other coordinate system may be used to asimilar effect.

As used herein, a video or video input is a finite set of frames(images) displayed quickly in sequence to create the illusion ofcontinuity (or smoothness). The level of smoothness depends, largely, onthe Frame Rate of the camera being used. Frame Rate is measured inframes per second (fps). The default setting on typical smartphones isusually 30 fps or 60 fps, but modern phones are also capable of higherframe rates which are used in features such as slow-motion video(usually 240 fps). In some aspects, the described models are built torun with feasible accuracy at 30 fps (which saves phone storage andbattery), but they can also run at higher frame rates, which wouldincrease the accuracy further. Furthermore, images themselves are just agrid of pixels e.g. 1280×720, each having an RGB (Red, Green, Blue)value. Therefore, a video can be represented as a list of frames, whichis a 2D array of pixel values. For example, a 5 second video at 720p and30 fps will be a (1280×720×3×150) sized array of numbers.

As will be described in greater detail below, using the describedtechniques, movement of the ball may be captured using a single cameraand a 3D track of the ball generated therefrom. The 3D ball track may beprovided to various users to aid in improving skills, judgingcompetitions, and the like. In some cases, various metrics, such asspeed, bounce, height, etc., can also be determined based on the 3D balltrack and provided to a user to better inform the user on otherattributes of the ball in motion.

It should be appreciated that a cricket gaming environment is only givenby way of example, and that the described systems and techniques can beadapted and applied to various other gaming environments includingbaseball, football, soccer, basketball, and various other gamingenvironments that utilize a ball or other small moving object whereanalysis of the movement of such a ball or object would be useful.

FIG. 2 illustrates an example view 200 of a 3D ball track or pathgenerated by the device/system 102 of FIG. 1 . View 200 may include thecombination of a number of frames of an input video, such as captured bydevice 102 of FIG. 1 , with indications (e.g., circles) of 2D balllocations 202, 204, 206, 208, 210, 212, 214, 216, 218 etc. captured inthe video over a time period. Such ball detections (e.g., provided by aneural network) may be false detections 214, 216, 218 or correctdetections or detections that generally align with a track of a ballthat conforms to real-world physics, 202, 204, 206, 208, 210, 212. Alsoillustrated in FIG. is a derived track or path of the ball 220, whichtracks a number of the ball locations 202, 204, 206, 208, 210, 212. Aswill be described in greater detail below, various ball locations orpositions may be identified through a number of frames of a video. A 3Dtrack of the ball may then be determined by fitting the 3D curve to theball locations, where outlier ball positions may be identified anddiscarded, ultimately to generate an accurate 3D track of the ball in agaming environment.

FIG. 3 illustrates diagram 300 of an example 3D ball tracking system 306in communication with a user/camera device 302. As illustrated, a userdevice 302, such as a smartphone or other computing device (e.g.,laptop, tablet, or even a desktop computing device), may include or beconnected to or in communication with a camera device 304. Camera device304 may include one or more video or image capturing devices. The userdevice 302 may also include a graphical user interface 328, which maydisplay images or video captured by the camera device 304, such as whentaking a video or image, and may display a generated 3D ball track froma gaming environment, including, in some cases, metrics associated withmovement of the ball captured or derived from the generated 3D balltack.

In some cases, the user device 302, such as through the camera device304, may capture video of an action in a gaming environment, such as apitch or throw of a ball, and may communicate that video at operation330 to a 3D ball tracking system 306. As illustrated, the 3D balltracking system 306 may be a collection of computing resources that canprocess video input and output a 3D track or movement path of a ball inan environment, such as a gaming environment, as well as metrics orother information associated with movement of the ball (or otherobject). In some cases, one or more components of the 3D ball trackingsystem 306 may include hardware resources, software resources, and/orcould computing resources, or any combination thereof. In some cases,the 3D ball tracking system 306 may be provided by one or more serversthat are in communication with the user device 302. In other cases, the3D ball tracking system 306 or components thereof may be provided by oneor more cloud or virtual computing resources, such as virtual machines,containers, etc., virtual databases, etc. In yet some cases, some or allof the 3D ball tracking system 306 may be provided by the user device302, whereby zero to some of the processes performed by the 3D balltracking system 306 may be done in conjunction with various eternalresources over one or more networks.

As illustrated, the 3D ball tracking system 306 may include a cameraprojection matrix generation process 308, which may also be generallyreferred to as camera calibration. In some cases, the camera projectionmatrix generation process 308 may be a process executed by the 3D balltracking system 306 to align or map elements in a 2D captured frame orframes to a 3D real world representation of those elements.

Camera calibration is the process of localizing real world points basedon the 2D content in an image. The goal is to solve for the cameraparameters (location in 3D, rotation, zoom) by identifying points likethe stump and pitch where their real-world location is known relative toeach other or other important objects or point in a given game. In someaspects, various techniques for performing camera calibration, as areknown in image process and computer vision arts, can be used on videodata/frames of a gaming environment to map 2D points captured by a videocamera to an accurate 3D representant of the events captured.

In some aspects, camera calibration and processes therefor, may beequivalent to finding a projection matrix which converts a 3D point inmeters to a 2D point in pixels, using techniques that are known in theart. For example, assume a 3D point (0, 0, 0), which may represent themiddle of the pitch on the ground:

x∈R ³

With a projection matrix C, the 3D point can be projected to a 2D imagepointy, i.e., (0,0), which may refer to the top left of the image, where(720, 1280) may refer to the bottom right of the image, which isprovided by the following equations:

y=C*x=Projection(x)

C=x{circumflex over ( )}(−1)*y

While this is an oversimplified explanation of determining a projectionmatrix, (e.g., in some aspects, the process includes more than matrixmultiplication), there are a few more steps, but consider this as theprojection function, which will be explained in more detail below.

The top and bottom of the stumps may be used as “keypoints”. This isbecause there are well-defined locations for these points in meters(e.g., bottom of striker middle stump is (0, 0, −10.06) in a 3Dcoordinate system).

In some aspects, to detect the stumps, a U-Net convolutional neuralnetwork or other convolutional neural network may be trained to predictthe top and bottom of the stumps. The-Net convolutional neural networkmay supplement a usual contracting network by successive layers, wherepooling operations may be replaced by up-sampling operators. Hence theselayers increase the resolution of the output. A successive convolutionallayer can then learn to assemble a precise output based on thisinformation. One modification in U-Net is that there are a large numberof feature channels in the up-sampling part, which allow the network topropagate context information to higher resolution layers. As aconsequence, the expansive path is more or less symmetric to thecontracting part, and yields a u-shaped architecture. The network onlyuses the valid part of each convolution without any fully connectedlayers. To predict the pixels in the border region of the image, themissing context is extrapolated by mirroring the input image. Thistiling strategy is important to apply the network to large images, sinceotherwise the resolution would be limited by the GPU memory.

In some cases, the exact number of data points needed to train aComputer Vision model like this varies, but 10000 data points across adiversity of settings (backgrounds, colors, lightings, etc.) is used asa rule of thumb, in some examples. In one example, where 4000+datapoints have been used for training, the resultant model worksout-of-the-box in settings that are not similar to ones it has beentrained on. As more data is collected and annotated, the model or modelsmay become exceedingly more robust.

In an embodiment, a system/process 328 can calibrate a camera to computea camera projection matrix which can provide a mapping from points inthe actual real-world 3D environment of the camera to 2D points on thescreen of the camera/phone. By automatically identifying objects in thegaming environment which are of known sizes and distances from eachother, various examples are able to compute this projection matrix. Suchobjects or markings may include court lines or gaming objects such ashoops, goals, bases, or wickets. The act of computing a cameraprojection matrix can be done in various suitable ways. For instance, insome embodiments, automatic identification of objects of previouslyknown dimensions is not necessary. In various embodiments, a user maytap on various places on a 2D screen to manually input where certainobjects are and then this input can be used to compute a projectionmatrix. In other embodiments, device sensors such as accelerometers mayhelp in computing the projection matrix by providing additionalinformation about the camera orientation. However, in some embodiments,automatic detection of one or more objects does not require manual inputand the system automatically identifies where these objects are on ascreen or in an image, after which the camera projection matrix can becomputed. Automatic calibration can be used in some examples. Fullymanual, fully automatic and hybrid calibration methods can be used insome examples.

In embodiments where the camera is handheld or not completely stable, acamera projection matrix per frame may be computed for high accuracytracking. In one possible embodiment, this can be obtained by runningthe aforementioned method on each frame of the video separately toobtain a projection matrix per frame. Alternatively, this may be done onintermittent frames, called keyframes, and the camera calibrations fornon-keyframes can be obtained by using optical flow from the keyframesor another similar algorithm which may use the apparent motion of thecamera.

FIGS. 4-6 illustrate example steps in a process to determine aprojection matrix for a view in a gaming environment, which may beperformed by the device/system of FIGS. 1 and 3 , and/or morespecifically by the camera projection matrix generation process 308. Insome cases, the example steps/views 400-600 of a camera calibration orcamera projection matrix generation process may be performed in part orin response to inputs from a user of a user device, such as user device302/102. In some optional aspects, bounding boxes or areas may be knownor determined that typically contain certain features of the gamingenvironment, such as bounding boxes 402, 404 illustrated in view 400 ofFIG. 4 . These areas may be used to focus a search or analysis of thepixels within these areas to identify the stumps 406, 408 in a cricketgame (or alternatively for other points in different types of gamingenvironments). In some aspects, these bounding boxes may be autogenerated and/or input or modified by a user, such as via GUI 328 of auser device 302 used to capture video of game action. In some aspects,the bounding boxes 402, 404 may be drawn, moved, or modified in one ormore dimensions by a user using a touch screen GUI. In other aspects,the bounding boxes may be auto generated by the 3D ball tracking system306, and invisible or hidden to a user.

FIG. 5 illustrates the identification, shown by dotted circles 502-506,508-512, and 514, 516, respectively, around the tops and bases of thebowler and batter stumps 518, 520. (only two dotted circles 514, 516 areillustrated for clarity with respect to batter stumps 520; however, itshould be appreciated that in some cases, the top and bottom of eachbatter stump 520 may be individually identified or the top and bottomsof each of the bowler and batter stumps 518, 520 may be used to asimilar effect. Via identification of the 2D locations (e.g., pixelspace locations) of the tops and bottoms of the bowler and batter stumps518, 520, the location of the stumps in the 2D image (pixel locations)and in 3D (known real world position in meters) can now be correlated.With this correlation, linear algebra may be used o find this projectionmatrix. For example, the system has now determined a set of 2D→3Dcorrespondences. For example, the top of the middle stump which has 3Dpoint (0, 0.7, −10) corresponds to image point (250, 400). For eachcorrespondence, 3D and 2D point, x_(i) ∈R³ y_(i) ∈R² are now known.

The system can solve for a camera matrix which minimizes thereprojection error from the 3D real world point to the detected point in2D, represented by the following:

$C = {{Arg}\min_{c}{\sum\limits_{i}\left( {{{Projection}\left( x_{i} \right)} - y_{i}} \right)^{2}}}$

This equation may be solved using, for example, the Ceres library,and/or the Levenberg-Marquardt algorithm, as are known by those havingordinary skill in the art.

In some cases, a RANSAC technique, or other equivalent technique, may beused to remove outliers (incorrect stump detections). With thisprojection, a virtual world may be constructed that completely alignswith the user's screen, as illustrated in view 600 of FIG. 6 . In theexample of view 600, court lines or other similar features 602, 604,606, 608, 610 may be identified via the techniques described aboveand/or overlaid onto the image of the gaming environment to providepoints of reference for a user to more clearly interpret captured gameplay. This generated virtual world also enables tracking the ball in 3D,as opposed to only doing tracking in 2D.

As described above, the projection matrix or model, such as generated bysystem/process 308, may enable identification of the 2D pixelcoordinates of the stumps on the phone screen, where the position of thestumps on screen can be used to establish an understanding or mapping ofthe 3D world.

In some cases, a user of the described systems and techniques mayperform a few simple steps to ensure a device with a camera is setupproperly to capture frames/video of a ball in a gaming environment toenable the functionality described herein. First, the user may setup thecamera on tripod, or any structure that enables the device to bestationary for at least 5 seconds or so. Next, the device/tripod may bemoved or placed at a position such that all stumps are visible (e.g.,for some length of time such as 1, 2, 3, 4, 5, 10, 15 seconds, etc.) andthere is an unobstructed view of the delivery when the ball is bowled.Some examples of acceptable setups may include anywhere behind thebowler stump, either on the ground or any height above the ground, backand above the bowler stump, and various other positions that stillensure an unobstructed view of the ball as it is thrown or moves in thegaming environment.

Returning back to FIG. 3 , as illustrated, the 3D ball tracking system306 may also include a 2D ball location process or system 310. In somecases, the 2D ball location process or system 310 may be a processexecuted by the 3D ball tracking system 306 to identify ball locationsthroughout a plurality of frames of a captured video including movementof a ball or other gaming object in a gaming environment.

In various examples, any suitable number of candidate 2D imagelocations, including 0, may be identified for each frame of an inputvideo. These candidates can be identified in some examples using aConvolutional Neural Network (CNN) 312 which may, for example, betrained on thousands of images where the 2D image location of the ballis labelled. This CNN may be trained on single images where the imagelocation of the ball is labelled or, in the case of a temporal CNN insome example, on a sequence of frames (e.g., three consecutive frames orother suitable number), which allows the CNN to learn to identify a ballas it's 2D position changes across frames, while its 3D position ischanging in the real world. Example CNN architectures may include theUNet or ResNet architectures. In other embodiments, an LSTM neuralnetwork may be used to detect the ball in a single frame of the video.In various embodiments, the input video may also be cropped based on theprojection matrix in order to only focus on areas of the gamingenvironment where the ball is likely to be located, such as near thepitcher's mound or the cricket pitch. In one implementation of anembodiment for cricket, over 10,000 frames of ball data from 50different physical locations may be collected and annotated to train theCNN.

FIG. 7 illustrates an example view 700 of candidate ball locations thatmay be detected or identified from a number of frames from a videoinput. As illustrated in view 700, some ball locations may clearly formatrack or ball path, such as ball locations 702-712, whereas other balllocations, 714-718 may be far out of line from a ball path. In yet somecases, some ball locations, such as 720 and 722 may be close to the ballpath, but may not be readily discarded as erroneous ball detections. Aswill be described in greater detail below, an inlier detection algorithmmay be utilized to classify these ball locations 720, 722 as erroneousor not.

As also illustrated in FIG. 3 , the 3D ball tracking system 306 may alsoinclude a 3D ball track or path generator system or process 312. In somecases, a 3D ball track or path generator 312 may be a system orcollection of computing resources that executes an optimization process316, as will be described in greater detail below, and uses one or more3D physics models 318 (which be selected according to a type of gamingenvironment for which the system is operating in or on) a to generate a3D track or path of a ball in video captured of a gaming environment. Insome cases, the 3D ball track or path generator 312 may perform anoptimization algorithm 316 that uses a 3D ball physics model and the 2Dimage locations of the ball to find the best fitting 3D curve of a pathcapturing movement of the ball in time.

In various examples, the position of the ball in a 2D image does notuniquely identify the position in 3D. This can be because the ball canbe at various distances from the camera and still appear in the same 2Dimage location. However, when a ball is moving, the trajectory can bemodeled with simple laws of physics. Various embodiments can find thebest 3D curve that satisfies the laws of physics and also matches upwith the observed ball locations in 2D. A 3D physics model 318, as partof the 3D ball track generator 314, of the ball's movement in thereal-world can, in some examples, be defined in parametric coordinateswith an equation for each dimension, by equations that may resemble thefollowing (the x, y, and z axes are shown visually in diagram 2):

x _(t) =a _(x) *t+b _(x),

where the ball position along the x axis at time t, x_(t), is a linearfunction.

y _(t) =a _(y) *t ² +b _(y) *t+c _(y),

where the ball position along the y axis at time t, y_(t), is aquadratic function. The gravitational constant a_(y) is already known tous by the laws of physics.

z _(t) =a _(z) *t+b _(z),

where the ball position along the z axis at time t, z_(t), is a linearfunction.

The parameters to solve for in such an example can be a_(x) . . . b_(z)which we can collectively call θ. The function p_(θ)(t), with known θ,would then output the position in 3D of the ball at time t, that can becomputed using the x, y, and z formulas above. In other words, the balltrack can be parametrized by θ. A ball physics model can be more complexin various embodiments to account for bounce, swing (in air curve), airresistance (slowdown), and other suitable physics, environmentalfactors, ball characteristics, and the like. For example, the y functionmay be a piecewise quadratic in a sport like cricket where the ballfrequently bounces during the pitch. The x function may also be aquadratic function to account for a sport like baseball where the ball'smovement in the horizontal direction is not linear due to possible curveballs. For example, in one embodiment for cricket, additional parametersused for optimization can be expressed as d_(x), d_(y), d_(z), whichdescribe how the ball bounces in the x, y, and z directionsrespectively.

The above example formulas exemplify a simple physics model for the 3Dball track, and should not be construed as being limiting. Furtherphysics models can be simpler or more complex in various furtherembodiments.

Amongst the set of 2D image locations of the ball at various times, each2D image location can be the pixel location of the ball at time t. Thiscan be represented in various examples as:

b _(t) ∈R ²

where for each frame index t, we have a 2D ball detection in the image.

Given a set of 2D ball detections b_(t), in various embodiments we canattempt to optimize for 0 using the equation below:

θ=Argmin_(θ)Σ_(t)(Projection_(t)(p _(θ)(t)))b _(t))²

The above formula can find a parametric 3D ball track such that the 3Dposition projected onto the camera screen (e.g., using a known cameraprojection matrix) that aligns with the detected ball position on thecamera screen at every time step. Projection_(t) refers to the cameraprojection matrix associated with frame t.

Such a 3D track may not be unique, which is why some embodiments canemploy heuristics about the 3D track of the ball, such as the 3Dposition where the ball is released from (e.g., the pitcher's mound inbaseball), reasonable places it could bounce (e.g., in cricket), andreasonable speeds of the ball. Such heuristics can be formulated as hardconstraints or inequalities on the parameters of θ given as g(θ). Forexample, minimum and maximum speeds of the pitch for baseball or cricketcan result in bounds on the parameter a_(z), which can describe themovement of the ball in the direction of the batsman. In one embodimentfor cricket and baseball, a neural network is used to detect the frameand position where the ball is thrown, and this location and frame ispassed as a constraint to the 3D physics trajectory.

In one possible embodiment, the optimization equation can be formulatedas follows to include desired constraints and heuristics, where weassign some penalty to our constraints on the trajectory g(θ)

θ=Argmin_(θ)Σ_(t)(Projection(p _(θ)(t)))−b _(t))² +λ*g(θ)

In one embodiment, computing such a nonlinear least-squares optimizationcan be done with the Ceres Solver library and the Levenberg—Marquardtalgorithm. Other suitable algorithms and methods for computing thisoptimization may be used in further embodiments.

FIG. 8 illustrates an example view 800 of a 3D ball track 802 mapped toa number candidate ball locations that may be detected or identifiedfrom a number of frames from a video input. As illustrated in view 800,track 802 may generally align with and map to a larger number of 3D balllocations, but may diverge from some of the ball locations due tophysical constraints of movement of the ball.

As also illustrated in FIG. 3 , the 3D ball tracking system 306 mayalso, optionally in some embodiments, include an inlier detectionprocess 320. In some cases, inlier detection process 320 may be aprocess executed by the 3D ball tracking system 306 to refine whichcandidate 2D ball locations, such as detected and identified by the 2Dball location process 310, are used to generate a 3D track or path of aball in video captured of a gaming environment. In some aspects, theinlier detection process 320 enables a 3D curve to be fir to 2D imagedata that is robust to errors of the ball location process 310. In someembodiments, inlier detection process 320 can include an application ofthe algorithm known as RANSAC, which can provide robustness to errors ina ball detector. Given that the ball detector may falsely identifynon-ball objects as the ball, optimizing over all detections can lead toa poor 3D track that will try to fit the correct and incorrect balldetections.

For example, let us assume that the 2D ball location process 310identifies X 2D ball location candidates across the plurality of frames.A RANSAC algorithm or similar algorithm can randomly select N subsets ofsize k; for each subset of k 2D ball location candidates, a line can befitted using by the 3D ball track generator 314/optimization process 316and the distance between the fitted line and the remaining (X-k)candidates can be calculated. Amongst the (X-k) candidates, those thatare within a predefined threshold distance from the line can beidentified as inliers. Subsets that contain false ball detections maygenerally produce a curve that does not fit the remaining (X-k)detections. The subset with the highest number inliers after fitting acurve to the subset of k detections can be selected.

In some embodiments, one or more neural networks may be used to selectthe best curve, instead of only choosing the curve with the mostinliers, such as may be trained on annotated frames of a gamingenvironment. In other embodiments, the inlier detection may be a 2Dtracking algorithm such as a Kalman Filter or a shortest path algorithmwhich first finds a candidate subset of the 2D detections beforeperforming the 3D curve fitting optimization previously described onthis subset of detections.

Returning to FIG. 3 , one or more of the camera projection matrixgeneration process 308, the 2D ball location process 310, the 3D balltrack generator 314 and/or the inlier detection process 320 may utilizedata that may be locally or remotely stored and accessed from one ormore storage devices or services 322. In one example, the storage device322 may store one or more 3D physics models 324, which may be an exampleof 3D physics model 318, such as may be adapted or optimized fordifferent gaming environments or different actions within differentgaming environments, such as pitches in baseball, cricket, etc., aquarterback thrown in football, a swing in golf, baseball, or cricket, akick in soccer, etc. The 3D psychics model(s) 324 may capture certainmovement patterns or bounds to those movement patterns of a ball orother object in gaming environment, which may be observed or known, suchas a bounce in a cricket bowl or pitch, a curve ball in baseball, offaxis rotation of a football, and so on.

In yet some cases, the storage device 322 may also store and/or enableaccess to one or more neural networks 326, which may include one or moreCNNs 312 utilized by a 2D ball location process 310, one or more neuralnetworks utilized by the camera projection matrix generation process308, 3D ball track generator 314, and/or the inlier detection process320. In some cases, the 3D ball tracking system 306 may provide for aninterface, such as through GUI 328 of user device 302, to enable usersto rate or otherwise annotate generated 3D tracks, to enable bettertraining of one or more neural networks 326 used by the 3D ball trackingsystem 306. In this way, as more users use the system 306, results maybe better refined to provide more accurate tracks.

Upon generating and/or refining a 3D ball track of a ball moving in agaming environment, the ball track may be provided to the user device302, such as at operation 332 illustrated in FIG. 3 . In some cases, theGUI 328 of the user device may format or otherwise modify the 3D balltrack and display the ball track on at least one frame of the gamingenvironment captured by camera 304.

In some aspects, view 800 may not be shown to a user, as it may providesome confusion as to where the track of the ball actually is and/or maynot provide useful information to the user. FIG. 9 illustrates anotherexample view 900, of a 3D generated ball track 902 without theidentified ball locations, which may be displayed to a user, such asthrough GUI 328 of user device 302. The ball track 902 may be fullythree-dimensional representation, such that in some embodiments, the GUI328 may provide for panning or changing a viewpoint of the ball track902, such that the ball track 902 can be viewed from 360 degrees in thehorizonal plane and/or vertical plane to provide for further analysis ofthe movement of the ball. In some cases, distances and other informationmay be annotated on the screen, such as may be determined used the 3Dphysics model.

View 900 may additionally include one or more displays 904, 906, 908, ofvarious metrics or attributes of a pitch of a ball, such as the cricketball illustrated in FIG. 9 . For example, a max speed of the ball may bedetermined form the generated 3D ball track 902 and displayed in a boxor icon 904. A spin and swing of the ball may similarly be displayed at906, 908. Other metrics may also be determined and/or displayed for theball, such as the location of the ball at certain points in the movement(e.g., height of the pitch as certain distances in the x, y, or zdirection), and the like.

FIG. 10 illustrates an example process 1000 or generating a 3D balltrack or path using a camera. In some examples, process 1000 may beperformed by the 3D ball tracking system 306 and/or the user device 302described above in reference to FIG. 3 . In some cases, operations ofprocess 1000 may be performed by one or more of the camera projectionmatrix generation process 308, the 2D ball location process 310, the 3Dball track generator 314, and/or the inlier detection process 320, asdescribed above in reference to FIGS. 3-9 .

Process 1000 may begin at operation 1002, in which an input video of aball moving in a gaming environment recorded may be obtained and/orrecorded by a camera, such as camera 304 of user device 302, where theinput video includes a plurality of frames. In some cases, the inputvideo may be obtained by a single camera, or multiple cameras co-locatedon or with a single device, such as a user device. In one example,gaming environment can include a cricket gaming environment, a baseballgaming environment, a football gaming environment, a soccer gamingenvironment, or a basketball gaming environment.

Next, at operation 1004 a camera projection matrix, or matrices,associated with the frames of the input video and the gaming environmentmay be obtained. In some cases, the camera projection matrix maps orcorrelates a two-dimensional pixel space representation to athree-dimensional representation of the gaming environment. In somecases, the camera projection matrix may be obtained from a separateservice, or may be generated as part of process 1000, such as by cameraprojection matrix generation process 308 described in greater detailabove in reference to FIG. 3 . In some cases, such as when the camera isstationary, one camera projection matrix may be sued for a number offrames or all frames of a video. In other cases, such as when the camerais not stationary, multiple matrices may be obtained or determined, suchas for every frame (e.g., when the camera is moving a lot or whenaccuracy is important), or for a subset of frames or key frames (framesselected to represent the video, such that may be selected to correspondto every other, every 3^(rd), every 5 frame and so on). In some cases, aplurality of camera projection matrices may be obtained or generated,wherein individual camera projection matrices of the plurality of cameraprojection matrices are associated with individual key frames of theplurality of frames of the input video and the gaming environment,wherein generating an individual camera projection matrix comprisesidentifying at least two points in an individual key frame that have afixed dimensional relationship with each other and correlating the atleast two points between a two-dimensional pixel space representationand a three-dimensional physical representation.

At operation 1006 candidate two-dimensional image locations of the ballmay be identified or detected across the plurality of frames of theinput video of the gaming environment using at least one of a neuralnetwork or a computer vision algorithm. In some cases, operation 1006may be performed by the 2D ball location process 310 described ingreater detail above in reference to FIG. 3 .

At operation 1008 an optimization algorithm may be performed, that usesa 3D ball physics model, the camera projection matrix or matrices and atleast a subset of the candidate two-dimensional image locations of theball to generate a three-dimensional track of the ball in the gamingenvironment that incorporates at least the subset of the candidatetwo-dimensional image locations of the ball to satisfy the 3D physicalsmodel. In some cases, operation 1006 may be performed by the 3D balltrack generator 314 described in greater detail above in reference toFIG. 3 . In some cases, a subset of the candidate two-dimensional imagelocations of the ball may be selected from the candidate two-dimensionalimage locations of the ball by removing erroneous candidate locations ofthe ball. In some cases, the 3D physics model includes at least twoequations selected based on movement patterns of the ball in the gamingenvironment.

At operation 1010, the three-dimensional track of the ball may beprovided to a user device such as including a graphical representationof the three-dimensional track of the ball to a GUI 328 of a user device302. In some examples, process 1000 may also include generating metricsof movement of the ball based on the three-dimensional track of theball; and providing the metrics overlaid onto a representation of thethree-dimensional track of the ball in the gaming environment tographical user interface of the user device.

In some examples, process 1000 may additionally include applying one ormore constraints, based on the three-dimensional physics model of theball, to generate the three-dimensional track of the ball in the gamingenvironment. The one or more constraints may include one or more of alocation in a frame of the plurality of frames of where the ball ispitched from, a sound captured by the video input that correlates to aspecific action or event in the gaming environment, deviation in thehorizontal or vertical direction of the ball being less than a thresholdfor a specific gaming environment, a speed of the ball being between aminimum speed and a maximum speed or a position of one or more of theplayers in the gaming environment. In some cases, the three-dimensional3D ball physics model accounts for at least one of bounce, spin, swing,or air resistance as of the ball.

In some examples process 1000 and/or other aspects of the techniquesdescribed herein may be performed for any moving object in a multitudeof different environments, such as traffic accident detection andanalysis, military applications, such as detecting projectiles, or otherflying objects, civilian flying object analysis, such as plane travel,drone travel, and so on.

FIG. 11 illustrates another example process 1100 for generating a 3Dball track or path and associated metrics using a single camera. In someexamples, process 1100 may be performed by the 3D ball tracking system306 and/or the user device 302 described above in reference to FIG. 3 .In some cases, operations of process 1100 may be performed by one ormore of the camera projection matrix generation process 308, the 2D balllocation process 310, the 3D ball track generator 314, and/or the inlierdetection process 320, as described above in reference to FIGS. 3-9 .

Process 1100 may begin at operation 1102, in which an input video of thegaming environment recorded by a single camera of a user device may beobtained, such as camera 304 of user device 302, where the input videoincludes a plurality of frames of a ball being thrown.

At operation 1104, a camera projection matrix or matrices associatedwith the frames of the input video and the gaming environment may begenerated by identifying at least two points in the gaming environmentthat have a fixed dimensional relationship with each other andcorrelating the at least two points between a two-dimensional pixelspace representation and a three-dimensional physical representation. Insome cases, the camera projection matrix may be generated by cameraprojection matrix generation process 308 described in greater detailabove in reference to FIG. 3 .

At operation 1106, candidate two-dimensional image locations of the ballmay be identified across the plurality of frames of the input video ofthe gaming environment using a neural network trained on past videoinputs of the gaming environment. In some cases, operation 1106 may beperformed by the 2D ball location process 310 described in greaterdetail above in reference to FIG. 3 .

At operation 1108, an optimization algorithm may be performed that usesa 3D ball physics model, the camera projection matrix, or matrices, anda subset of the candidate two-dimensional image locations of the ball tocompute the parameters of an equation that estimates thethree-dimensional position of the ball moving in the gaming environmentby aligning the subset of the candidate two-dimensional image locationsof the ball with the three-dimensional ball physics model. In somecases, operation 1108 may be performed by the 3D ball track generator314, such as including one or more aspects of optimization process 316,described in greater detail above in reference to FIG. 3 .

At operation 1110, optionally, an inlier detection algorithm may be usedor applied in conjunction with the optimization algorithm to select thesubset of the candidate two-dimensional image locations of the ball fromthe candidate two-dimensional image locations of the ball for use in theoptimization algorithm. In some cases, operation 1110 may be performedby the inlier detection process 320 described in greater detail above inreference to FIG. 3 . In some cases, operations 1108 and 1110 may beperformed in an iterative process, such that the equation generated byoperation 1108 may be refined one or more times by the inlier detectionalgorithm, to generate a best fit 3D curve to the 2D ball locations.

At operation 1112, a three-dimensional track of the ball may begenerated using the determined parameters in the equation that estimatesthe three-dimensional position of the ball moving in the gamingenvironment. In some cases, operation 1112 may be performed by the 3Dball track generator 314 described in greater detail above in referenceto FIG. 3 . The three-dimensional track of the ball and metrics ofmovement of the ball of the three-dimensional track may then be providedto the user device.

Some embodiments can include a method for determining the 3D position ofa ball moving in a gaming environment, given an input video of thegaming environment that was recorded on a single, stable camera and acamera projection matrix associated with each frame of the input videoand the gaming environment, comprising: performing a Computer Visionalgorithm to identify candidate 2D image locations of the ball across aplurality of frames of the input video of the gaming environment;performing an optimization algorithm that uses a 3D ball physics model,the camera projection matrix associated with each of the frames of theinput video and the aforementioned set of significant 2D image locationsto compute the parameters of an equation that estimates the 3D positionof the ball moving in the gaming environment; performing an inlierdetection algorithm, such as RANSAC or 2D tracking, in conjunction withthe optimization algorithm which may identify a set of significant 2Dimage locations of the ball and provide a 3D ball track that may berobust to incorrect detections.

The described embodiments are susceptible to various modifications andalternative forms, and specific examples thereof have been shown by wayof example in the drawings and are herein described in detail. It shouldbe understood, however, that the described embodiments are not to belimited to the particular forms or methods disclosed, but to thecontrary, the present disclosure is to cover all modifications,equivalents, and alternatives. Additionally, elements of a givenembodiment should not be construed to be applicable to only that exampleembodiment and therefore elements of one example embodiment can beapplicable to other embodiments. Additionally, in some embodiments,elements that are specifically shown in some embodiments can beexplicitly absent from further embodiments. Accordingly, the recitationof an element being present in one example should be construed tosupport some embodiments where such an element is explicitly absent.

1-20. (canceled)
 21. A computer-implemented method for determining atrack of a ball moving in a gaming environment, the method comprising:obtaining an input video of the gaming environment recorded by a singlecamera of a user device, the input video comprising a plurality offrames of a ball being thrown; generate a plurality of camera projectionmatrices, wherein individual camera projection matrices of the pluralityof camera projection matrices are associated with individual fames ofthe plurality of frames of the input video and the gaming environment,wherein generating an individual camera projection matrix comprisesidentifying at least two points in an individual frame that have a fixeddimensional relationship with each other and correlating the at leasttwo points between a two-dimensional pixel space representation and athree-dimensional physical representation; identifying candidatetwo-dimensional image locations of the ball across the plurality offrames of the input video of the gaming environment using a neuralnetwork trained on past video inputs of the gaming environment;performing an inlier detection algorithm to select a subset of thecandidate two-dimensional image locations of the ball from the candidatetwo-dimensional image locations of the ball that fit a curve; using theplurality of camera projection matrices and a subset of the candidatetwo-dimensional image locations of the ball forming the curve toestimate three-dimensional positions of the ball moving in the gamingenvironment; and providing metrics of movement of the ball based on thethree dimensional positions of the ball to the user device.
 22. Thecomputer-implemented method of claim 21, wherein metrics comprise atleast one of a maximum speed of the ball, spin of the ball, swing of theball, or at least one height of the ball.
 23. The computer-implementedmethod of claim 21, wherein performing the inlier detection algorithm toselect the subset of the candidate two-dimensional image locations ofthe ball from the candidate two-dimensional image locations of the ballthat fit the curve further comprises: selecting the subset of thecandidate two-dimensional image locations of the ball from the candidatetwo-dimensional image locations of the ball by removing erroneouscandidate locations of the ball that are not within a threshold distancefrom the curve, wherein the curve is determined by fitting a pluralityof randomly selected subsets of the candidate two-dimensional imagelocations of the ball.
 24. The computer-implemented method of claim 21,wherein the gaming environment comprises a cricket gaming environment,and wherein the at least two points correlate to at least one of aposition of one or more stumps, a location of a bat contacting a ball,or a location of the ball bouncing on the ground.
 25. Thecomputer-implemented method of claim 21, wherein the gaming environmentcomprises a baseball gaming environment, and wherein the at least twopoints correlate to at least one of a position relative to a pitcher'smound, a location of a bat contacting a ball, or a glove contacting theball.
 26. A computer-implemented method, comprising: obtaining an inputvideo of a ball moving in a gaming environment recorded by a camera, theinput video comprising a plurality of frames; obtaining a cameraprojection matrix associated with at least one frame of the plurality offrames of the input video and the gaming environment, the cameraprojection matrix mapping a two-dimensional pixel space representationto a three-dimensional representation of the gaming environment;identifying candidate two-dimensional image locations of the ball acrossthe plurality of frames of the input video of the gaming environmentusing at least one of a neural network or a computer vision algorithm;using the camera projection matrix and at least a subset of thecandidate two-dimensional image locations of the ball to generatethree-dimensional locations of the ball in the gaming environment; andprovide metrics of movement of the ball in the gaming environment basedon the three-dimensional locations of the ball to a user device.
 27. Thecomputer-implemented method of claim 26, further comprising: selectingthe subset of the candidate two-dimensional image locations of the ballfrom the candidate two-dimensional image locations of the ball byremoving erroneous candidate locations of the ball.
 28. Thecomputer-implemented method of claim 26, wherein obtaining the cameraprojection matrix further comprises: generating a plurality of cameraprojection matrices, wherein individual camera projection matrices ofthe plurality of camera projection matrices are associated withindividual key frames of the plurality of frames of the input video andthe gaming environment, wherein generating an individual cameraprojection matrix comprises identifying at least two points in anindividual key frame that have a fixed dimensional relationship witheach other and correlating the at least two points between atwo-dimensional pixel space representation and a three-dimensionalphysical representation;
 29. The computer-implemented method of claim26, wherein the gaming environment comprises a cricket gamingenvironment, a baseball gaming environment, a football gamingenvironment, a soccer gaming environment, or a basketball gamingenvironment.
 30. The computer-implemented method of claim 26, furthercomprising applying one or more constraints to movement of the ball togenerate at least a subset of the three-dimensional locations of theball in the gaming environment.
 31. The computer-implemented method ofclaim 30, wherein the one or more constraints further comprises at leastone of: a location in a frame of the plurality of frames of where theball is pitched from; a sound captured by the video input thatcorrelates to a specific action or event in the gaming environment;deviation in the horizontal or vertical direction of the ball being lessthan a threshold for a specific gaming environment; a speed of the ballbeing between a minimum speed and a maximum speed; or a position of oneor more of the players in the gaming environment.
 32. Thecomputer-implemented method of claim 26, further comprising: providingthe metrics overlaid onto a representation of movement of the ball inthe gaming environment to a graphical user interface of the user device.33. The computer-implemented method of claim 26, wherein metricscomprise at least one of a maximum speed of the ball, spin of the ball,swing of the ball, or at least one height of the ball.
 34. Thecomputer-implemented method of claim 26, wherein the gaming environmentcomprises a cricket gaming environment, and wherein the at least twopoints correlate to at least one of a position of one or more stumps, alocation of a bat contacting a ball, or a location of the ball bouncingon the ground.
 35. The computer-implemented method of claim 21, whereinthe gaming environment comprises a baseball gaming environment, andwherein the at least two points correlate to at least one of a positionrelative to a pitcher's mound, a location of a bat contacting a ball, ora glove contacting the ball.
 36. A method for determining atwo-dimensional track of a ball moving in a gaming environment, themethod comprising: obtaining an input video of the gaming environmentrecorded by a single camera of a user device, the input video comprisinga plurality of frames of a ball being thrown; generate a plurality ofcamera projection matrices, wherein individual camera projectionmatrices of the plurality of camera projection matrices are associatedwith individual fames of the plurality of frames of the input video andthe gaming environment, wherein generating the camera projectionmatrices comprises identifying at least two points in an individualframe that have a fixed dimensional relationship with each other andcorrelating the at least two points between a two-dimensional pixelspace representation and a three-dimensional physical representation;identifying candidate two-dimensional image locations of the ball acrossthe plurality of frames of the input video of the gaming environmentusing a neural network trained on past video inputs of the gamingenvironment; performing an inlier detection algorithm on the candidatetwo-dimensional image locations to select a subset of the candidatetwo-dimensional image locations of the ball that are fit to a curve fromthe candidate two-dimensional image locations of the ball; generatingthree-dimension ball locations from the subset of the candidatetwo-dimensional image locations of the ball forming the curve using atleast one of the plurality of camera projection matrices based on the atleast two points; and providing metrics of movement of the ball based onthe three-dimensional ball locations.
 37. The method of claim 36,wherein performing the inlier detection algorithm on the candidatetwo-dimensional image locations to select the subset of the candidatetwo-dimensional image locations of the ball that are fit to the curvefurther comprises using a 2D tracking algorithm.
 38. The method of claim36, wherein the gaming environment comprises a cricket gamingenvironment, and wherein the at least two points correlate to at leastone of a position of one or more stumps, a location of a bat contactinga ball, or a location of the ball bouncing on the ground.
 39. The methodof claim 36, wherein the gaming environment comprises a baseball gamingenvironment, and wherein the at least two points correlate to at leastone of a position relative to a pitcher's mound, a location of a batcontacting a ball, or a glove contacting the ball.
 40. The method ofclaim 36, wherein metrics comprise at least one of a maximum speed ofthe ball, spin of the ball, swing of the ball, or at least one height ofthe ball.